home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
exkey4.arc
/
EXKEY.DOC
next >
Wrap
Text File
|
1990-01-27
|
8KB
|
179 lines
This archive should contain the following files:
EXTKEY.ASM - Source code for the interrupt handler
EXTKEY.OBJ - Object file of the above, ready for linking
EXKEY.PAS - Turbo Pascal (v4.0 upwards) code for the
ExKey Unit.
EXKEY.TPU - Exkey Unit ready compiled (TP 5.5)
TPTEST.PAS - Source for a simple Turbo Pascal test
program that demonstrates the unit in action.
TPTEST.EXE - Compiled version of above
EXKEY.DOC - This file
───────────────────────────────- NOTICE ────────────────────────────────
(C) Copyright Aubrey Scoon (Scoon Consultancy Services) 1990
All rights reserved
This product is shareware. This means you can (and are encouraged
to), copy and distribute it freely without the express permission
of the author, subject to the following conditions:
1) This product is to be distributed preferably in unaltered form together
with this document file. If you wish to make improvements to the
source code please feel free but please mark which bits are the
original code and which you have added. Please do not remove any
original credits, copyrights or acknowledgements from the
source code. This document file is NOT be altered in any way.
2) This product is not to be sold by any party other than the
author without the express permission of the author; no money
is to be charged for its distribution, except inasmuch as a
nominal fee that may be charged for the medium of its
distribution e.g diskette.
3) The author retains all rights of ownership and copyright and may
change, supersede or otherwise dispose of this product at his
discretion without liability to any other party.
4) The author accepts no responsibility for loss of data or damage
to systems arising through the use or misuse of this product.
5) If you use this product (especially if you incorporate it into
any commercial package) a small monetary donation to the
author (address below) would be appreciated. The amount is up
to you, you can pay what you think its worth to you.
───────────────────────────────────────────────────────────────────────-
EXKEY - User Documentation
──────────────────────────
What is ExKey ?
───────────────
ExKey is an assembler patch that replaces the default INT 16
keyboard handler. It provides support (via the normal INT 16
functions 0,1,2) for extended style AT and PS/2 keyboards.
Why is it needed ?
─────────────────-
Many modern IBM compatible machines have "extended" IBM style 101
and 102 key keyboards. Unfortunately the default keyboard handler
routines in most machines were only designed to handle the old
IBM PC type keyboard. This means that certain keys on the
extended keyboard are unusable with many software packages,
notably the F11 and F12 function keys. Many machines however DO
provide extended keyboard support but ONLY through different INT
16 function calls. This means in effect that although your BIOS
may actually support these extra keys you STILL wont be able to
use them with your latest software product unless you write your
own handler routines.
A typical example of this is Turbo Pascal. If you look at the
Turbo Pascal reference manual (page 424 in version 5.5 -
different page no in other versions) you will see that it lists
scan codes for extended keyboards, including the codes for F11
and F12. However on many machines when you try to use the F11 and
F12 scan codes (codes 133 upwards) you will probably find that it
doesn't work ! This isn't a problem with Turbo Pascal, its a
problem with the BIOS of many machines.
ExKey gets round this problem by mapping the old keyboard
routines on to the new extended routines. The result is that if
you include the ExKey code in your program, you should now be
able to use the extra function keys as normal i.e. they will
return their scan codes as documented.
ExKey wont neccessarily work on ALL machines with an extended
keyboard. ExKey tests the BIOS data area flags to see if there is
an extended keyboard present. If not it will invoke the default
keyboard routines (i.e. it will not make any difference). On all
other machines it will attempt to invoke the enhanced keyboard
handler. If it still doesn't work it means that your BIOS is
incapable of handling an enhanced keyboard i.e. it does not
support the INT 16h functions 10h,11h and 12h.
This routine is therefore a compromise - it should work on all
machines that were supplied with an extended keyboard.
This archive contains both a Turbo Pascal Unit (with source), so
you can use ExKey with Turbo Pascal, and a copy in Microsoft
standard object file format for you to link into other compilers
or assemblers if you wish.
Using ExKey
───────────
ExKey is very easy to use. There are no parameters needed. All
you have to do is call the procedure SetKeyVector at the
beginning of your program (usually in the initialisation code)
and RestoreKeyVector just before leaving your program. This
applies to both the Assembler version and the TP version. The
rest is completely automatic. SetKeyvector redirects the INT 16
interrupt to the internal routine NewKey, and RestoreKeyVector
restores the default interrupt handler when you have finished.
Exkey also offers an additional function called
"Ext_Keyboard_Present", which detects if an extended keyboard is
present or not. From Turbo Pascal simply call the function of
that name and it returns a boolean flag TRUE or FALSE if an
extended keyboard is present. See TPTEST for an example. From
assembler you can also call this function, when it returns in
the AL register the value 0 if no extended keyboard is present
or the value 1 if it is. All registers other than AL are
preserved.
WARNING: If you make the execution of SetKeyVector conditional
upon the keyboard flag you MUST do the same with
RestoreKeyVector. Otherwise if your routine tries to run
SetKeyVector WITHOUT RestoreKeyVector, or vice versa it will
crash the machine. It is not neccessary to make the execution of
the vector routines conditional anyway as they will autodetect
the presence or absence of an extended keyboard anyway and act
appropriately without user intervention.
NOTE: If you call the assembler routines directly, you need to
use a FAR call model.
The scan codes for the extra key functions are as follows:
┌─────┬───────────────────┬────────────┬───────────┬──────────┐
│ Key │ Normal(unshifted) │ With Shift │ With Ctrl │ With Alt │
├─────┼───────────────────┼────────────┼───────────┼──────────┤
│ F11 │ 133 │ 135 │ 137 │ 139 │
│ F12 │ 134 │ 136 │ 138 │ 140 │
└─────┴───────────────────┴────────────┴───────────┴──────────┘
These keys also return a null (character 0) character code when
pressed, like the other "normal" function keys.
If you have any questions about this product please contact me at
the following address (or leave a message on the BBS below).
Aubrey Scoon
Scoon Consultancy Services
49 Honeyhill Road,
Bracknell,
Berkshire.
RG12 1YH
U.K.
Messages may be left for me on the BBS below:
Mission Impossible (Nottingham) (0602) 654329
Hawk's Castle (Bracknell) (0344) 411621
Both support 300,1200,2400 and 9600HST speeds, 8 bits, no parity,
1 stopbit, 24 hours per day.
I would like to thank Alan Guyan for pointing out a method of
detecting an enhanced keyboard and his help in testing the
routine, and John Franklin for his help in finding the bugs and
his suggestion for a solution which is incorporated into this
routine.
Aubrey Scoon.